package com.project.androidjukebox;

import java.util.ArrayList;
import java.util.HashMap;

import android.util.Log;

// this acts as a server and database until we implement real server and database
public class Server {

	public static ArrayList<HashMap<String, String>> available_songs = new ArrayList<HashMap<String, String>>();	
	
	public ArrayList<HashMap<String, String>> getList(){
		return available_songs;
	}
	
	public void setList(ArrayList<HashMap<String, String>> list){
		available_songs=list;
	}
	
	public void setVote(int index){
		HashMap<String, String> temp = available_songs.get(index);
		int votes = Integer.parseInt(temp.get("Votes"));
		votes += 1;
		HashMap<String, String> map = new HashMap<String, String>();
		map.put("Name", temp.get("Name"));
		map.put("Votes", votes+"");
		map.put("Path", temp.get("Path"));
		available_songs.set(index, map);
		Log.v("VOTE CASTED", "THIS SONG HAS NOW: "+votes);
	}
}
